import { post, get } from './axios'
import { get_downLoad} from './axios_downLoad'
import { post_uploadFile} from './axios_uploadFile'

// //获取设备系统树形数据
// export function getTreeData() {
//     return new Promise((resolve, reject) => {
//         get('/device/itgSystem/getTreeData',{noLoading:true}).then((data) => {
//             resolve(data);
//         }).catch((error) => {
//             reject(error)
//         })
//     })
// }

//获取设备系统树形数据
export function getTreeData() {
    return new Promise((resolve, reject) => {
        get('/device/itgSystem/getTreeDataByProjectId',{noLoading:true}).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//获取所有报警等级
export function alarmLevelGetAll() {
    return new Promise((resolve, reject) => {
        get('/msg/alarmLevel/getAll').then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//获取项目网关报警未处理报警数
export function getQueryNoProcessCount() {
    return new Promise((resolve, reject) => {
        get('/msg/gatewayAlarm/queryNoProcessCount').then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//根据项目Id获取网关报警分页数据
export function gatewayAlarmList(params: {}) {
    return new Promise((resolve, reject) => {
        // post('/msg/gatewayAlarm/queryPageByProjectId', params).then((data) => {
        post('/msg/gatewayAlarm/queryAllPage', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//网关报警记录详情
export function gatewayAlarmGetDetail(id: string) {
    return new Promise((resolve, reject) => {
        get('/msg/gatewayAlarm/getDetail/' + id).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//网关报警处理
export function gatewayAlarmEditProcess(params: {}) {
    return new Promise((resolve, reject) => {
        post('/msg/gatewayAlarm/editProcess', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

// 根据建筑类型id获取空间分类树形数据
export function spaceTypegetTreeData(id: string) {
    return new Promise((resolve, reject) => {
        get('/device/spaceType/getTreeData/'+id).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

// 空间详情
export function spaceGetDetail(id: string) {
    return new Promise((resolve, reject) => {
        get('/device/space/getDetail/'+id).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

// 获取空间分页列表
export function spaceQueryPage(params: {}) {
    return new Promise((resolve, reject) => {
        post('/device/space/queryPage',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

// 空间删除
export function spaceDel(params: {}) {
    return new Promise((resolve, reject) => {
        post('/device/space/del',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

// 空间列表导出房间
export function spaceExportSpace(params: object) {
    return new Promise((resolve, reject) => {
        get_downLoad('/device/space/exportSpace', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

// 空间列表导出楼层
export function spaceExportFloor(params: object) {
    return new Promise((resolve, reject) => {
        get_downLoad('/device/space/exportFloor', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//  空间导出模板
export function spaceExportTemplate() {
    return new Promise((resolve, reject) => {
        get_downLoad('/device/space/exportTemplate').then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

// 空间编辑
export function getQrCodeList(params: {}) {
    return new Promise((resolve, reject) => {
        post('/device/space/getQrCodeList',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

// 获取空间树形数据
export function spaceGetTreeData(params?:any) {
    return new Promise((resolve, reject) => {
        get('/device/space/getTreeData',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

// 空间新增
export function spaceAdd(params: {}) {
    return new Promise((resolve, reject) => {
        post('/device/space/add',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

// 空间编辑
export function spaceEdit(params: {}) {
    return new Promise((resolve, reject) => {
        post('/device/space/edit',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//获取项目使用类型绑定楼层数量列表
export function queryUseTypeCount() {
    return new Promise((resolve, reject) => {
        get('/device/useType/queryUseTypeCount').then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//使用类型新增
export function useTypeAdd(params:object) { 
    return new Promise((resolve,reject)=>{
        post('/device/useType/add',params).then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}

//使用类型编辑
export function useTypeEdit(params:object) { 
    return new Promise((resolve,reject)=>{
        post('/device/useType/edit',params).then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}

//使用类型删除
export function useTypeDel(params:object) { 
    return new Promise((resolve,reject)=>{
        post('/device/useType/del',params).then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}

//获取项目使用类型分页列表
export function queryPageProject(params:object) { 
    return new Promise((resolve,reject)=>{
        post('/device/useType/queryPageProject',params).then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}

//获取楼层分页列表
export function floorQueryPage(params:object) { 
    return new Promise((resolve,reject)=>{
        post('/device/useTypeFloor/queryPage',params).then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}

//获取建筑-楼层树形结构数据
export function getBuildFloorTreeData() { 
    return new Promise((resolve,reject)=>{
        get('/device/space/getBuildFloorTreeData').then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}

//使用类型楼层新增
export function useTypeFloorAdd(params:object) { 
    return new Promise((resolve,reject)=>{
        post('/device/useTypeFloor/add',params).then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}

//使用类型楼层编辑
export function useTypeFloorEdit(params:object) { 
    return new Promise((resolve,reject)=>{
        post('/device/useTypeFloor/edit',params).then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}
//使用类型楼层删除
export function useTypeFloorDel(params:object) { 
    return new Promise((resolve,reject)=>{
        post('/device/useTypeFloor/del',params).then((data)=>{
            resolve(data);
        }).catch((error)=>{
            reject(error)
        })
    })
}

//设备上下游 供配电系统关系 获取分页列表
export function deviceRelationQueryPage(params:any) {
    return new Promise((resolve, reject) => {
        post('/device/deviceRelation/queryPage', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//设备上下游 供配电系统关系 新增
export function deviceRelationAdd(params: {}) {
    return new Promise((resolve, reject) => {
        post('/device/deviceRelation/add', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//设备上下游 供配电系统关系 删除
export function deviceRelationDel(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/deviceRelation/del', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//设备上下游 供配电系统关系 编辑
export function deviceRelationEdit(params: {}) {
    return new Promise((resolve, reject) => {
        post('/device/deviceRelation/edit', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//设备上下游 供配电系统关系 详情
export function deviceRelationGetDetail(id: string) {
    return new Promise((resolve, reject) => {
        get('/device/deviceRelation/getDetail/' + id).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

// 用于设备上下游的设备列表数据 
export function deviceQueryDeviceList(params: {}) {
    return new Promise((resolve, reject) => {
        post('/device/device/queryDeviceList', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

// 用于设备上下游的设备列表数据 
export function floorDetDetails(id: string) {
    return new Promise((resolve, reject) => {
        get('/device/useTypeFloor/getDetail/'+id).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//使用类型楼层导出模板 
export function floorExportTemplate() {
    return new Promise((resolve, reject) => {
        get_downLoad('/device/useTypeFloor/exportTemplate').then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//使用类型楼层导入
export function floorImportFloor(params: object) {
    return new Promise((resolve, reject) => {
        post_uploadFile('/device/useTypeFloor/importFloor',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//通过设备id列表查找对应测点列表
export function getPointByDeviceIds(params:any) {
    return new Promise((resolve, reject) => {
        get('/device/devicePoint/queryByDeviceIds',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//设备列表
export function deviceQueryDevice(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/device/queryDevice', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//根据项目Id获取所有网关列表
export function gatewayQueryAll(params: {}) {
    return new Promise((resolve, reject) => {
        post('/device/gateway/queryAll', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//设备详情
export function getDeviceDetail(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/device/queryDeviceDetail', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//导出网关接入使用
export function export2Gateway(params: object) {
    return new Promise((resolve, reject) => {
        get_downLoad('/device/device/export2Gateway', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//导出平台使用
export function export2Platform(params: object) {
    return new Promise((resolve, reject) => {
        get_downLoad('/device/device/export2Platform', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//导出平台使用
export function importDevice(params: object) {
    return new Promise((resolve, reject) => {
        post_uploadFile('/device/device/importDevice', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//流媒体 全量/增量导入
export function importMediaDevice(params: object) {
    return new Promise((resolve, reject) => {
        post_uploadFile('/device/device/importMediaDevice', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//流媒体导出平台使用
export function export2MediaPlatform(params: object) {
    return new Promise((resolve, reject) => {
        get_downLoad('/device/device/export2MediaPlatform', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//导出模板
export function exportTemplate() {
    return new Promise((resolve, reject) => {
        get_downLoad('/device/device/exportTemplate').then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//流媒体导出模板
export function exportMediaTemplate() {
    return new Promise((resolve, reject) => {
        get_downLoad('/device/device/exportMediaTemplate').then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//设备删除
export function deviceDelDevice(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/device/delDevice',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//设备新增
export function deviceAddDevice(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/device/addDevice',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//设备修改
export function editDevice(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/device/editDevice',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//测点
export function getDevicePointList(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/devicePoint/queryPoint',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//上传材料
export function uploadDeviceMaterial(params: object) {
    return new Promise((resolve, reject) => {
        post_uploadFile('/device/alioss/uploadDeviceMaterial', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//企业管理 分页列表
export function companyQueryPage(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/company/queryPage', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//企业管理 查看
export function companyGetDetail(id: string) {
    return new Promise((resolve, reject) => {
        get('/device/company/getDetail/'+ id).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//企业管理 分页列表
export function companyDel(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/company/del', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//企业管理 新增
export function companyAdd(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/company/add', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//企业管理 编辑
export function companyEdit(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/company/edit', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//企业管理 导出
export function companyExport(params: object) {
    return new Promise((resolve, reject) => {
        get_downLoad('/device/company/export', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//企业管理房间树形数据
export function getTreeDataByUseTypeId() {
    return new Promise((resolve, reject) => {
        get('/device/company/getTreeDataByUseTypeId').then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//企业管理编辑时 房间树形数据
export function getTreeDataById(id: string) {
    return new Promise((resolve, reject) => {
        get('/device/company/getTreeDataById/' + id).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//项目查询
export function projectQueryProjectDetail(id: string) {
    return new Promise((resolve, reject) => {
        get('/device/project/queryProjectDetail/' + id).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//项目查询
export function projectEditProjectExt(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/project/editProjectExt', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//空间状态分页列表
export function useTypeRoomQueryPage(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/useTypeRoom/queryPage', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//空间状态分页新增
export function useTypeRoomAdd(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/useTypeRoom/add', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//空间状态删除
export function useTypeRoomDel(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/useTypeRoom/del', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//空间状态编辑
export function useTypeRoomEdit(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/useTypeRoom/edit', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//获取使用类型下属楼层列表
export function getFloorTree() {
    return new Promise((resolve, reject) => {
        get('/device/useTypeFloor/getFloorTree').then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//根据使用类型建筑-楼层-房间树形数据
export function getTreeData_useTypeId(useTypeId: string) {
    return new Promise((resolve, reject) => {
        get('/device/useTypeRoom/getTreeDataByUseTypeId/'+useTypeId).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//根据楼层Id获取房间列表数据
export function getRoomsByFloorId(floorId: string) {
    return new Promise((resolve, reject) => {
        get('/device/useTypeRoom/getRoomsByFloorId/'+floorId).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//根据房间Id获取空间状态
export function getRoomsState(roomId: string) {
    return new Promise((resolve, reject) => {
        get('/device/useTypeRoom/queryRoomSate/'+roomId).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//根据房间Id获取空间状态
export function useTypeRoom_exportTemplate(params: object) {
    return new Promise((resolve, reject) => {
        get_downLoad('/device/useTypeRoom/exportTemplate',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//空间状态导入
export function useTypeRoomImport(params: object) {
    return new Promise((resolve, reject) => {
        post_uploadFile('/device/useTypeRoom/importRoom', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//空间列表导入
export function importSpace(params: object) {
    return new Promise((resolve, reject) => {
        post_uploadFile('/device/space/importSpace', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//上传空间图纸
export function uploadSpaceFloor(params: object) {
    return new Promise((resolve, reject) => {
        post_uploadFile('/device/alioss/uploadSpaceFloor', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

// 新增-关系树
export function addRelation(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/deviceRelation/addRelation', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//根据关系id获取左侧树形数据-关系树
export function getRelationThree(relationId: string) {
    return new Promise((resolve, reject) => {
        get('/device/deviceRelation/getRelationThree/' + relationId).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//根据上级id获取下级数据列表-关系树
export function getRelationList(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/deviceRelation/getRelationList', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//删除-关系树
export function delRelation(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/deviceRelation/delRelation', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//关系树替换
export function editRelation(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/deviceRelation/editRelation', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}


//企业管理上传合同
export function uploadCompanyLease(params: object) {
    return new Promise((resolve, reject) => {
        post_uploadFile('/device/alioss/uploadCompanyLease', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//获取企业部门树形数据
export function companyDeptGetTreeData(companyId: string) {
    return new Promise((resolve, reject) => {
        get('/device/companyDept/getTreeData/' + companyId).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//企业部门-详情
export function companyDeptDetail(id: string) {
    return new Promise((resolve, reject) => {
        get('/device/companyDept/getDetail/' + id).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//根据企业id获取关联房间列表
export function getCompanyRoomsByCompanyId(companyId: string) {
    return new Promise((resolve, reject) => {
        get('/device/company/getCompanyRoomsByCompanyId/' + companyId).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//企业部门-分页列表
export function companyDeptQueryPage(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/companyDept/queryPage',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//企业部门-新增
export function companyDeptAdd(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/companyDept/add',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//企业部门-新增部门用户
export function companyDeptAddUser(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/companyDept/addUser',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//企业部门-删除
export function companyDeptDel(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/companyDept/del',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//企业部门-编辑
export function companyDeptEdit(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/companyDept/edit',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//导入部门用户
export function importUser(params: object) {
    return new Promise((resolve, reject) => {
        post_uploadFile('/device/companyDept/importUser',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//资产管理-分页列表
export function assetQueryPage(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/asset/queryPage',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//资产管理-获取资产分类树形数据
export function assetTypeGetTreeData() {
    return new Promise((resolve, reject) => {
        get('/device/assetType/getTreeData').then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//资产管理-资产新增
export function assetAdd(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/asset/add', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//资产管理-资产编辑
export function assetEdit(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/asset/edit', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//资产管理-资产删除
export function assetDel(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/asset/del',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//资产详情
export function assetGetDetail(id: string) {
    return new Promise((resolve, reject) => {
        get('/device/asset/getDetail/' + id).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

// 根据参数名称模糊查询参数列表
export function queryAssetParameterList(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/asset/queryAssetParameterList',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//获取企业列表
export function companyGetCompanyList() {
    return new Promise((resolve, reject) => {
        get('/device/company/getCompanyList').then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//根据部门Id获取用户列表
export function getUserListByDeptId(id: string) {
    return new Promise((resolve, reject) => {
        get('/device/companyDept/getUserListByDeptId/' + id).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//资产管理-二维码
export function getQrCodeListByIds(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/asset/getQrCodeListByIds',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

// 资产管理导出
export function assetExportAsset(params: object) {
    return new Promise((resolve, reject) => {
        get_downLoad('/device/asset/exportAsset', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//  资产管理导出模板
export function assetExportTemplate() {
    return new Promise((resolve, reject) => {
        get_downLoad('/device/asset/exportTemplate').then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//资产管理 全量/增量导入
export function assetImportAsset(params: object) {
    return new Promise((resolve, reject) => {
        post_uploadFile('/device/asset/importAsset', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//资产管理-批量配置所属关系
export function assetUpdateCompanyByIds(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/asset/updateCompanyByIds',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//空间变更记录
export function spaceChangeLogQueryPage(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/spaceChangeLog/queryPage',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//工位变更记录
export function spaceStationChangeLogQueryPage(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/spaceStationChangeLog/queryPage',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//工位管理-办公位置树形结构
export function getRoomTreeData() {
    return new Promise((resolve, reject) => {
        get('/device/useTypeRoom/getRoomTreeData').then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//工位管理-获取房间树形数据
export function spaceStationTreeData() {
    return new Promise((resolve, reject) => {
        get('/device/spaceStation/getSpaceTreeData').then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//工位管理-详情
export function spaceStationDetail(id:string) {
    return new Promise((resolve, reject) => {
        get('/device/spaceStation/getDetail/'+id).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//工位管理-根据工位Id获取关联资产分页数据
export function queryPageByStationId(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/asset/queryPageByStationId',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//工位管理-新增
export function spaceStationAdd(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/spaceStation/add',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//工位管理-删除
export function spaceStationDel(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/spaceStation/del',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//工位管理-编辑
export function spaceStationEdit(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/spaceStation/edit',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//工位管理-根据Id集合获取二维码列表
export function spaceStationQrCode(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/spaceStation/getQrCodeListByIds',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//工位管理-分页列表
export function spaceStationQueryPage(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/spaceStation/queryPage',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//工位管理-批量配置所属关系
export function updateCompanyByIds(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/spaceStation/updateCompanyByIds',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//  工位管理-导出模板
export function spaceStationTemplate() {
    return new Promise((resolve, reject) => {
        get_downLoad('/device/spaceStation/exportTemplate').then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//空工位管理-导入
export function importStation(params: object) {
    return new Promise((resolve, reject) => {
        post_uploadFile('/device/spaceStation/importStation', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//获取ram账户(oss账户信息)
export function getFrontAccess() {
    return new Promise((resolve, reject) => {
        get('/device/alioss/getFrontAccess').then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

// 首页-获取项目信息
export function homePageQueryProjectDetail() {
    return new Promise((resolve, reject) => {
        get('/device/homePage/queryProjectDetail').then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

// 首页-获取设备、用户、资产、企业总数
export function homePageGetDeviceCount() {
    return new Promise((resolve, reject) => {
        get('/device/homePage/getDeviceCount').then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

// 首页-获取资产各状态统计数量
export function getAssetStateCountByProjectId() {
    return new Promise((resolve, reject) => {
        get('/device/homePage/getAssetStateCountByProjectId').then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

// 首页-获取设备系统下设备统计数量
export function getDeviceSystemCount() {
    return new Promise((resolve, reject) => {
        get('/device/homePage/getDeviceSystemCount').then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

// 首页-获取工位各类型统计数量
export function getStationCountByProjectId() {
    return new Promise((resolve, reject) => {
        get('/device/homePage/getStationCountByProjectId').then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

// 首页-获取空间统计
export function getSpaceStateArea() {
    return new Promise((resolve, reject) => {
        get('/device/homePage/getSpaceStateArea').then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//工位变更记录-导出
export function spaceStationChangeLogExport(params: object) {
    return new Promise((resolve, reject) => {
        get_downLoad('/device/spaceStationChangeLog/export', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//空间变更记录-导出
export function spaceChangeLogExport(params: object) {
    return new Promise((resolve, reject) => {
        get_downLoad('/device/spaceChangeLog/export', params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//租赁到期提醒修改
export function editLeaseExpDays(params: object) {
    return new Promise((resolve, reject) => {
        post('/device//project/editLeaseExpDays',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}
// 获取当前环境
export function getSystemEnvironmentInfo() {
    return new Promise((resolve, reject) => {
        get('/device/szApi/getSystemEnvironmentInfo').then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//模型变更记录
export function modelChangeLogQueryPage(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/modelChangeLog/queryPage',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//模型变更记录-详情
export function modelChangeLogGetDetail(id:string) {
    return new Promise((resolve, reject) => {
        get('/device/modelChangeLog/getDetail/'+id).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//空间管理分类-获取树形数据
export function spaceTypeOwin_getTreeData() {
    return new Promise((resolve, reject) => {
        get('/device/spaceTypeOwin/getTreeData',).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//空间管理分类-分页列表
export function spaceTypeOwin_queryPage(params:object) {
    return new Promise((resolve, reject) => {
        post('/device/spaceTypeOwin/queryPage',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//空间管理分类-导出
export function spaceTypeOwin_export(params:object) {
    return new Promise((resolve, reject) => {
        get_downLoad('/device/spaceTypeOwin/export',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//空间管理分类-新增
export function spaceTypeOwin_add(params:object) {
    return new Promise((resolve, reject) => {
        post('/device/spaceTypeOwin/add',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//空间管理分类-删除
export function spaceTypeOwin_del(params:object) {
    return new Promise((resolve, reject) => {
        post('/device/spaceTypeOwin/del',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//空间管理分类-编辑
export function spaceTypeOwin_edit(params:object) {
    return new Promise((resolve, reject) => {
        post('/device/spaceTypeOwin/edit',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//空间管理分类-详情
export function spaceTypeOwin_detail(id:string) {
    return new Promise((resolve, reject) => {
        post('/device/spaceTypeOwin/getDetail/'+id).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//空间分类-运营平台分页查询
export function spaceStateQueryPageProject(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/spaceState/queryPageProject',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//空间状态-新增
export function spaceStateAdd(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/spaceState/add',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//空间状态-编辑
export function spaceStateEdit(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/spaceState/edit',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//空间状态-删除
export function spaceStateDel(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/spaceState/del',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//设置应用项目
export function spaceStateSetUseProject(params: object) {
    return new Promise((resolve, reject) => {
        post('/device/spaceState/setUseProject',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//根据类型获取状态列表
export function spaceStateGetStateList(type: any) {
    return new Promise((resolve, reject) => {
        get('/device/spaceState/getStateList/' + type).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}

//根据楼层id集合获取企业列表
export function getCompanyListByFloorIds(params: any) {
    return new Promise((resolve, reject) => {
        post('/device/company/getCompanyListByFloorIds',params).then((data) => {
            resolve(data);
        }).catch((error) => {
            reject(error)
        })
    })
}